<?php
/**
 * 学生获取购买课程信息
 * @author shej E-mail:28708@qq.com
 */
require_once '../../dz_framework/init.php';

$user_id = isset($_REQUEST['user_id'])?$_REQUEST['user_id']:"";

// limit 10 最近的10个课时

$svod_info = DB::fetch_all('select v.id,v.name from '.DB::table('vod')." v left join ".DB::table('student_course')." sc on v.id=sc.course_id where sc.uid='".$user_id."' and v.ctype=1 and sc.course_flag=1 and sc.course_cate =2 order by sc.dateline desc limit 10");	

if($svod_info)
{
	foreach ( $svod_info as $key=>$value )
	{
		$vodhour = DB::fetch_all("select id hid,name hname,introduction from ".DB::table('vod_hour')." where v_id='".$value['id']."'");
		$svod_info[$key]['vhourinfo'] = $vodhour;
	}
	print_r($svod_info);
	echo json_encode($svod_info); exit;
	
}else{
	
	echo json_encode(array('error'=>'no vod data')); exit;
}